package com.baizhi.controller;

import com.baizhi.entity.AdminLog;
import com.baizhi.service.AdminLogService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("adminLog")
public class AdminLogController {
    @Autowired
    private AdminLogService adminLogService;
    @ResponseBody
    @RequestMapping("selectAll")
    public Map selectAll(Integer page,Integer limit){
        PageInfo<AdminLog> pageInfo = adminLogService.selectAll(page, limit);
        Map map = new HashMap();
        map.put("code",0);
        map.put("msg","");
        map.put("count",pageInfo.getTotal());
        map.put("data",pageInfo.getList());
        return map;
    }
    @ResponseBody
    @RequestMapping("deleteAll")
    public Map deleteAll(Integer[] ids){
        Map map = new HashMap();
        Boolean isDelete = adminLogService.deleteAdminLogAll(ids);
        map.put("isDelete",isDelete);
        return map;
    }
    @ResponseBody
    @RequestMapping("insertAdminLog")
    public Map insert(AdminLog adminLog){
        Map map = new HashMap();
        Boolean isAdd = adminLogService.insertAdminLog(adminLog);
        map.put("isAdd",isAdd);
        return map;
    }
}
